package dataAccess;

import dataAccess.Connector;

public class GameDB {

	public static void NewGame() throws DALException {
		Connector
				.doUpdate("CREATE TABLE Player (Player_ID INTEGER PRIMARY KEY, Name VARCHAR(20), Account INTEGER, Jailcard INTEGER, Field INTEGER, turnsInJail INTEGER)");
		Connector
				.doUpdate("CREATE TABLE Field (Field_ID INTEGER PRIMARY KEY, Player_ID INTEGER, FieldName VARCHAR(30), Type VARCHAR(15), FOREIGN KEY (Player_ID) REFERENCES Player(Player_ID))");
		Connector
				.doUpdate("CREATE TABLE House (House_ID INTEGER PRIMARY KEY, Field_ID INTEGER, Houses INTEGER, Hotel BOOLEAN, FOREIGN KEY(Field_ID) REFERENCES Field(Field_ID))");
		Connector
				.doUpdate("CREATE TABLE LuckyCard (Card_ID INTEGER PRIMARY KEY, Description VARCHAR(200), Command VARCHAR(100), Bonus INTEGER, Jailcard BOOLEAN)");
		Connector
				.doUpdate("CREATE TABLE PawnedField (Pawn_ID INTEGER PRIMARY KEY, Field_ID INTEGER, PawnPrice INTEGER, IsPawned BOOLEAN, FOREIGN KEY (Field_ID) REFERENCES Field(Field_ID))");
		Connector
				.doUpdate("CREATE TABLE Price (Price_ID INTEGER PRIMARY KEY, Field_ID INTEGER, FieldPrice INTEGER, HousePrice INTEGER, FOREIGN KEY (Field_ID) REFERENCES Field(Field_ID))");
		Connector
				.doUpdate("CREATE TABLE Rent (Rent_ID INTEGER PRIMARY KEY, Field_ID INTEGER, BaseRent INTEGER, 1House INTEGER, 2Houses INTEGER, 3Houses INTEGER, 4Houses INTEGER, Hotel INTEGER, FOREIGN KEY (Field_ID) REFERENCES Field(Field_ID))");

		Connector
				.doUpdate("INSERT INTO Field VALUES(1, NULL, 'Start', 'Start')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(2, NULL, 'Roedovrevej', 'Ownable')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(3, NULL, 'Proev Lykken', 'Card')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(4, NULL, 'Hvidovrevej', 'Ownable')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(5, NULL, 'Betal skat', 'Tax1')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(6, NULL, 'LB Faergerne', 'Ship')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(7, NULL, 'Roskildevej', 'Ownable')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(8, NULL, 'Proev Lykken', 'Card')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(9, NULL, 'Valby Langgade', 'Ownable')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(10, NULL, 'Allegade', 'Ownable')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(11, NULL, 'Faengsel', 'Refuge')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(12, NULL, 'Frederiksberg All�', 'Ownable')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(13, NULL, 'Carlsberg', 'Brewery')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(14, NULL, 'Bulowsvej', 'Ownable')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(15, NULL, 'Gl. Kongevel', 'Ownable')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(16, NULL, 'Danmark', 'Ship')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(17, NULL, 'Bernstorfsvej', 'Ownable')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(18, NULL, 'Proev Lykken', 'Card')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(19, NULL, 'Hellerupvej', 'Ownable')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(20, NULL, 'Strandvej', 'Ownable')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(21, NULL, 'Parkering', 'Refuge')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(22, NULL, 'Trianglen', 'Ownable')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(23, NULL, 'Proev Lykken', 'Card')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(24, NULL, 'Oesterbrogade', 'Ownable')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(25, NULL, 'Groenningen', 'Ownable')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(26, NULL, 'Mols-linien A/S', 'Ship')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(27, NULL, 'Bredgade', 'Ownable')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(28, NULL, 'Kgs. Nytorv', 'Ownable')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(29, NULL, 'Coca-Cola', 'Brewery')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(30, NULL, 'Oestergade', 'Ownable')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(31, NULL, 'De Faengsles', 'Jail')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(32, NULL, 'Amagertorv', 'Ownable')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(33, NULL, 'Vimmelskaftet', 'Ownable')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(34, NULL, 'Proev Lykken', 'Card')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(35, NULL, 'Nygade', 'Ownable')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(36, NULL, 'Skandinavisk Linietrafik A/S', 'Ship')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(37, NULL, 'Proev Lykken', 'Card')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(38, NULL, 'Frederiksberggade', 'Ownable')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(39, NULL, 'Ekstraordinaer skat', 'Tax2')");
		Connector
				.doUpdate("INSERT INTO Field VALUES(40, NULL, 'Raadhuspladsen', 'Ownable')");

		Connector.doUpdate("INSERT INTO Price VALUES(2, 2, 1200, 1000)");
		Connector.doUpdate("INSERT INTO Price VALUES(4, 4, 1200, 1000)");
		Connector.doUpdate("INSERT INTO Price VALUES(6, 6, 4000, 0)");
		Connector.doUpdate("INSERT INTO Price VALUES(7, 7, 2000, 1000)");
		Connector.doUpdate("INSERT INTO Price VALUES(9, 9, 2000, 1000)");
		Connector.doUpdate("INSERT INTO Price VALUES(10, 10, 2400, 1000)");
		Connector.doUpdate("INSERT INTO Price VALUES(12, 12, 2800, 2000)");
		Connector.doUpdate("INSERT INTO Price VALUES(13, 13, 3000, 0)");
		Connector.doUpdate("INSERT INTO Price VALUES(14, 14, 2800, 2000)");
		Connector.doUpdate("INSERT INTO Price VALUES(15, 15, 3200, 2000)");
		Connector.doUpdate("INSERT INTO Price VALUES(16, 16, 4000, 0)");
		Connector.doUpdate("INSERT INTO Price VALUES(17, 17, 3600, 2000)");
		Connector.doUpdate("INSERT INTO Price VALUES(19, 19, 3600, 2000)");
		Connector.doUpdate("INSERT INTO Price VALUES(20, 20, 4000, 2000)");
		Connector.doUpdate("INSERT INTO Price VALUES(22, 22, 4400, 3000)");
		Connector.doUpdate("INSERT INTO Price VALUES(24, 24, 4400, 3000)");
		Connector.doUpdate("INSERT INTO Price VALUES(25, 25, 4800, 3000)");
		Connector.doUpdate("INSERT INTO Price VALUES(26, 26, 4000, 0)");
		Connector.doUpdate("INSERT INTO Price VALUES(27, 27, 5200, 3000)");
		Connector.doUpdate("INSERT INTO Price VALUES(28, 28, 5200, 3000)");
		Connector.doUpdate("INSERT INTO Price VALUES(29, 29, 3000, 0)");
		Connector.doUpdate("INSERT INTO Price VALUES(30, 30, 5600, 3000)");
		Connector.doUpdate("INSERT INTO Price VALUES(32, 32, 6000, 4000)");
		Connector.doUpdate("INSERT INTO Price VALUES(33, 33, 6000, 4000)");
		Connector.doUpdate("INSERT INTO Price VALUES(35, 35, 6400, 4000)");
		Connector.doUpdate("INSERT INTO Price VALUES(36, 36, 4000, 0)");
		Connector.doUpdate("INSERT INTO Price VALUES(38, 38, 7000, 4000)");
		Connector.doUpdate("INSERT INTO Price VALUES(40, 40, 8000, 4000)");

		Connector
				.doUpdate("INSERT INTO Rent VALUES(2, 2, 50, 250, 750, 2250, 4000, 6000)");
		Connector
				.doUpdate("INSERT INTO Rent VALUES(4, 4, 50, 250, 750, 2250, 4000, 6000)");
		Connector
				.doUpdate("INSERT INTO Rent VALUES(6, 6, 0, 500, 1000, 2000, 4000, 0)");
		Connector
				.doUpdate("INSERT INTO Rent VALUES(7, 7, 100, 600, 1800, 5400, 8000, 11000)");
		Connector
				.doUpdate("INSERT INTO Rent VALUES(9, 9, 100, 600, 1800, 5400, 8000, 11000)");
		Connector
				.doUpdate("INSERT INTO Rent VALUES(10, 10, 150, 800, 2000, 6000, 9000, 12000)");
		Connector
				.doUpdate("INSERT INTO Rent VALUES(12, 12, 200, 1000, 3000, 9000, 12500, 15000)");
		Connector.doUpdate("INSERT INTO Rent VALUES(13, 13, 0, 0, 0, 0, 0, 0)");
		Connector
				.doUpdate("INSERT INTO Rent VALUES(14, 14, 200, 1000, 3000, 9000, 12500, 15000)");
		Connector
				.doUpdate("INSERT INTO Rent VALUES(15, 15, 250, 1250, 3750, 10000, 14000, 18000)");
		Connector
				.doUpdate("INSERT INTO Rent VALUES(16, 16, 0, 500, 1000, 2000, 4000, 0)");
		Connector
				.doUpdate("INSERT INTO Rent VALUES(17, 17, 300, 1400, 4000, 11000, 15000, 19000)");
		Connector
				.doUpdate("INSERT INTO Rent VALUES(19, 19, 300, 1400, 4000, 11000, 15000, 19000)");
		Connector
				.doUpdate("INSERT INTO Rent VALUES(20, 20, 350, 1600, 4400, 12000, 16000, 20000)");
		Connector
				.doUpdate("INSERT INTO Rent VALUES(22, 22, 350, 1800, 5000, 14000, 17500, 21000)");
		Connector
				.doUpdate("INSERT INTO Rent VALUES(24, 24, 350, 1800, 5000, 14000, 17500, 21000)");
		Connector
				.doUpdate("INSERT INTO Rent VALUES(25, 25, 400, 2000, 6000, 15000, 18500, 22000)");
		Connector
				.doUpdate("INSERT INTO Rent VALUES(26, 26, 0, 500, 1000, 2000, 4000, 0)");
		Connector
				.doUpdate("INSERT INTO Rent VALUES(27, 27, 450, 2200, 6600, 16000, 19500, 23000)");
		Connector
				.doUpdate("INSERT INTO Rent VALUES(28, 28, 450, 2200, 6600, 16000, 19500, 23000)");
		Connector.doUpdate("INSERT INTO Rent VALUES(29, 29, 0, 0, 0, 0, 0, 0)");
		Connector
				.doUpdate("INSERT INTO Rent VALUES(30, 30, 500, 2400, 7200, 17000, 20500, 24000)");
		Connector
				.doUpdate("INSERT INTO Rent VALUES(32, 32, 550, 2600, 7800, 18000, 22000, 25000)");
		Connector
				.doUpdate("INSERT INTO Rent VALUES(33, 33, 550, 2600, 7800, 18000, 22000, 25000)");
		Connector
				.doUpdate("INSERT INTO Rent VALUES(35, 35, 600, 3000, 9000, 20000, 24000, 28000)");
		Connector
				.doUpdate("INSERT INTO Rent VALUES(36, 36, 0, 500, 1000, 2000, 4000, 0)");
		Connector
				.doUpdate("INSERT INTO Rent VALUES(38, 38, 700, 3500, 10000, 22000, 26000, 30000)");
		Connector
				.doUpdate("INSERT INTO Rent VALUES(40, 40, 1000, 4000, 12000, 28000, 34000, 40000)");

		Connector.doUpdate("INSERT INTO PawnedField VALUES(2, 2, 600, false)");
		Connector.doUpdate("INSERT INTO PawnedField VALUES(4, 4, 600, false)");
		Connector.doUpdate("INSERT INTO PawnedField VALUES(6, 6, 2000, false)");
		Connector.doUpdate("INSERT INTO PawnedField VALUES(7, 7, 1000, false)");
		Connector.doUpdate("INSERT INTO PawnedField VALUES(9, 9, 1000, false)");
		Connector
				.doUpdate("INSERT INTO PawnedField VALUES(10, 10, 1200, false)");
		Connector
				.doUpdate("INSERT INTO PawnedField VALUES(12, 12, 1400, false)");
		Connector
				.doUpdate("INSERT INTO PawnedField VALUES(13, 13, 1500, false)");
		Connector
				.doUpdate("INSERT INTO PawnedField VALUES(14, 14, 1400, false)");
		Connector
				.doUpdate("INSERT INTO PawnedField VALUES(15, 15, 1600, false)");
		Connector
				.doUpdate("INSERT INTO PawnedField VALUES(16, 16, 2000, false)");
		Connector
				.doUpdate("INSERT INTO PawnedField VALUES(17, 17, 1800, false)");
		Connector
				.doUpdate("INSERT INTO PawnedField VALUES(19, 19, 1800, false)");
		Connector
				.doUpdate("INSERT INTO PawnedField VALUES(20, 20, 2000, false)");
		Connector
				.doUpdate("INSERT INTO PawnedField VALUES(22, 22, 2200, false)");
		Connector
				.doUpdate("INSERT INTO PawnedField VALUES(24, 24, 2200, false)");
		Connector
				.doUpdate("INSERT INTO PawnedField VALUES(25, 25, 2400, false)");
		Connector
				.doUpdate("INSERT INTO PawnedField VALUES(26, 26, 2000, false)");
		Connector
				.doUpdate("INSERT INTO PawnedField VALUES(27, 27, 2600, false)");
		Connector
				.doUpdate("INSERT INTO PawnedField VALUES(28, 28, 2600, false)");
		Connector
				.doUpdate("INSERT INTO PawnedField VALUES(29, 29, 1500, false)");
		Connector
				.doUpdate("INSERT INTO PawnedField VALUES(30, 30, 2800, false)");
		Connector
				.doUpdate("INSERT INTO PawnedField VALUES(32, 32, 3000, false)");
		Connector
				.doUpdate("INSERT INTO PawnedField VALUES(33, 33, 3000, false)");
		Connector
				.doUpdate("INSERT INTO PawnedField VALUES(35, 35, 3200, false)");
		Connector
				.doUpdate("INSERT INTO PawnedField VALUES(36, 36, 2000, false)");
		Connector
				.doUpdate("INSERT INTO PawnedField VALUES(38, 38, 3500, false)");
		Connector
				.doUpdate("INSERT INTO PawnedField VALUES(40, 40, 4000, false)");

		Connector.doUpdate("INSERT INTO House VALUES(2, 2, 0, false)");
		Connector.doUpdate("INSERT INTO House VALUES(4, 4, 0, false)");
		Connector.doUpdate("INSERT INTO House VALUES(7, 7, 0, false)");
		Connector.doUpdate("INSERT INTO House VALUES(9, 9, 0, false)");
		Connector.doUpdate("INSERT INTO House VALUES(10, 10, 0, false)");
		Connector.doUpdate("INSERT INTO House VALUES(12, 12, 0, false)");
		Connector.doUpdate("INSERT INTO House VALUES(14, 14, 0, false)");
		Connector.doUpdate("INSERT INTO House VALUES(15, 15, 0, false)");
		Connector.doUpdate("INSERT INTO House VALUES(17, 17, 0, false)");
		Connector.doUpdate("INSERT INTO House VALUES(19, 19, 0, false)");
		Connector.doUpdate("INSERT INTO House VALUES(20, 20, 0, false)");
		Connector.doUpdate("INSERT INTO House VALUES(22, 22, 0, false)");
		Connector.doUpdate("INSERT INTO House VALUES(24, 24, 0, false)");
		Connector.doUpdate("INSERT INTO House VALUES(25, 25, 0, false)");
		Connector.doUpdate("INSERT INTO House VALUES(27, 27, 0, false)");
		Connector.doUpdate("INSERT INTO House VALUES(28, 28, 0, false)");
		Connector.doUpdate("INSERT INTO House VALUES(30, 30, 0, false)");
		Connector.doUpdate("INSERT INTO House VALUES(32, 32, 0, false)");
		Connector.doUpdate("INSERT INTO House VALUES(33, 33, 0, false)");
		Connector.doUpdate("INSERT INTO House VALUES(35, 35, 0, false)");
		Connector.doUpdate("INSERT INTO House VALUES(38, 38, 0, false)");
		Connector.doUpdate("INSERT INTO House VALUES(40, 40, 0, false)");

		Connector
				.doUpdate("INSERT INTO LuckyCard VALUES( 1, ' ', ' ', 0, false)");
		Connector
				.doUpdate("INSERT INTO LuckyCard VALUES( 2, ' ', ' ', 0, false)");
		Connector
				.doUpdate("INSERT INTO LuckyCard VALUES( 3, ' ', ' ', 0, false)");
		Connector
				.doUpdate("INSERT INTO LuckyCard VALUES( 4, ' ', ' ', 0, false)");
		Connector
				.doUpdate("INSERT INTO LuckyCard VALUES( 5, ' ', ' ', 0, false)");
		Connector
				.doUpdate("INSERT INTO LuckyCard VALUES( 6, ' ', ' ', 0, false)");
		Connector
				.doUpdate("INSERT INTO LuckyCard VALUES( 7, ' ', ' ', 0, false)");
		Connector
				.doUpdate("INSERT INTO LuckyCard VALUES( 8, ' ', ' ', 0, false)");
		Connector
				.doUpdate("INSERT INTO LuckyCard VALUES( 9, ' ', ' ', 0, false)");
		Connector
				.doUpdate("INSERT INTO LuckyCard VALUES(10, ' ', ' ', 0, false)");
		Connector
				.doUpdate("INSERT INTO LuckyCard VALUES(11, ' ', ' ', 0, false)");
		Connector
				.doUpdate("INSERT INTO LuckyCard VALUES(12, ' ', ' ', 0, false)");
		Connector
				.doUpdate("INSERT INTO LuckyCard VALUES(13, ' ', ' ', 0, false)");
		Connector
				.doUpdate("INSERT INTO LuckyCard VALUES(14, ' ', ' ', 0, false)");
		Connector
				.doUpdate("INSERT INTO LuckyCard VALUES(15, ' ', ' ', 0, false)");
		Connector
				.doUpdate("INSERT INTO LuckyCard VALUES(16, ' ', ' ', 0, false)");
		Connector
				.doUpdate("INSERT INTO LuckyCard VALUES(17, ' ', ' ', 0, false)");

	}

	public static void EndGame() throws DALException {
		Connector.doUpdate("DROP TABLE if EXISTS luckycard");
		Connector.doUpdate("DROP TABLE if EXISTS pawnedfield");
		Connector.doUpdate("DROP TABLE if EXISTS house");
		Connector.doUpdate("DROP TABLE if EXISTS price");
		Connector.doUpdate("DROP TABLE if EXISTS rent");
		Connector.doUpdate("DROP TABLE if EXISTS Field");
		Connector.doUpdate("DROP TABLE if EXISTS Player");
	}
}
